﻿package com.config;


import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016101800712752";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCd8xh2y3ym/yU2jaF0/k8/Z9jaSOyu8kkWGlFcVh5bulC4jyLNi2ZEPYCATJrSh0yu1Qvwa5tHnTMHYDZVwHy0P2zCBvqiHZzXXv35hak4JQJkrqXkb46BMCCUigEhrLAIRHMGmH8mBI2IMSrVsW0MP2g1qGLJSelziAHfdlWUYdz2GQa9acqRbnGsnEkNf1IMQEqb8ftt/OY7R7aGe+6MFW9NjitOCRfn5EC4FxuBTp/P5Du2m2wq3NJAWU3CFKvt97dUNZcD4EQIp3G2bCHgRmiH/boxydxsaXIzmIBanypzLhiBg/j5pdCqDkDB59J/Yfx8+Ygaq/v5+L/liJeDAgMBAAECggEBAJCWjUmKAyT4Ib+rrSZk+nSHgspnwUpw/pieJOaK6yV7DBO269wPBOHpDu3jskKQmpDc9B3002OeMq1I1NRw7XcvLEb9jofC5eV9zq6RPZPoxSUXf0L7IA+A2AJBxsFlzIr05fsetB5AQrNultChp7pzfNjJuQycfXlGArjmIXc/HmNh8dARr9eDCRG0LCExm+ZCI4+D3bpAV6XexdBI7hziKr2CNK6MTX691yKphM33a3JyeMsj4xt4NJWu5yKeCvdI9bORSSjaEKjcw5wmsckf0TLMm/LP3pKgEu24kBC6RSnsI9Eoo1+RG13asuaGQ1brMfX/4MBM7k9y3bqmDSECgYEA6d115FGg0fk5s76N5Qwn+6uVK4Whx2Qb+kS+Luqo3oYh0MWS/zt++izUi5flD3eBRnx9tXavPrwBbmO7w7U4+T8ZmCM1iztwiU1n+yn/uRnXGFelUkJk7+jWoB8JUOzd9Cu8kWUYfWVjeXj4o44jLmcAKgvUBjXfH1w+MMNoVtMCgYEArOY023dw2JGSNADi3KzBGCvkWWHjIRZtk5FcZ+LnWew8i/Uk23ZkJ77cqgqy8Xo2CsN6WChOH/omEcq4mR6gO4iuXjlFHqohTQ+0wcMN/5/baXTUcwPhtPmGEn549nlA2P9/bmporDPdubQjJotSNGsjIR5/GhKoE4L23tZkrpECgYBaXu7InNaFbUZj8/XHFex5bzOEju4WK9Q34MqRPLKm0rRMhZypLmeB60Ly8m5cjLSS9VZqggN0PZhb/QQ4u1XZ0w1j4e8173EsTZIp12/vKlIZIP1MjUWOA660T2n9MJsQWLpUgPl2s3A+J4YFRc7IhprkpI95GuYuqymJFGnEawKBgGfc7nm8OXzPjd1RfvaDjIeBrm4HQJLazz5rfvAlPUcmg4Sr4dU4PJgnrpUzUiV/fcFfhjo5FB1ffskHV3ccD7NTuzN9AcmW9+Q8ACC5lMovdHXYKdthxI+bqW+oq++cDVmNujZRE8oGajapQMhhvyMgDP1TPZUjCfaWoMhiUB8RAoGBAL6uwZ+63xTnE5qjhc9d/J+KKYDL6hRNcCriMIqDvSCxaSwTpY41PPxJ4Bp7RSobGZiryoBa2oPhvte3ytf0oWE1CQuvpGV9REBRuURfg7XQPRlXdeFBZJrREMiU+LN1kWuDzG+YFUPe8Q3jSIkwnolJ1WUjbzcPbQ/p92J7r13v";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAl5+GcSjXAErdx2OMURcUO71JoLB2MF0jQVZ7mtZQzkc8KraB5sYQhSnqwmDNi4JOQyEk5iqjhs3HO+Xq9Z6fu5kTlNO9k+mP4P0Yd/20x2Z6QhRYJC+5O8aD0Y4SPkVziXMRfG2TmX8O8ALmUNODdQo1oBOS8mpMEY8S+VYmPtejzgKrjtHKDcwEGf+gfyKXC1hzGyeCGszMPsqTwvd6FgvsIhvFiHsQ4gsYznIQ1wS/nbAhjHn5Vbf8X0TgieIy8wPTW8g3jH+KareBlpyyLIuF2hnpzlelYhEqAZk/3/4FCEO7wMJTeq4WusSnyEVwRb3P+LC+HdM4NW9Kxigq/wIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = " http://mb6fck.natappfree.cc/pay-demo/aliPayNotifyUrlServlet";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = " http://mb6fck.natappfree.cc/pay-demo/aliPayReturnUrlServlet";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

